<template>
  <div>
    <van-nav-bar
      title="服务中心"
      left-arrow
      left-text="返回"
      @click-left="Order"
    >
    </van-nav-bar>
    <van-cell is-link @click="Oninformation"
      ><van-icon name="friends-o" />个人信息</van-cell
    >
    <div style="margin: 16px">
      <van-button
        class="btn"
        color="#aa7700"
        round
        block
        type="info"
        native-type="submit"
        @click="Onsignout"
        >退出</van-button
      >
    </div>
  </div>
</template>

<script>
import axios from "axios";
export default {
  mounted() {
    this.getData();
  },
  methods: {
    getData() {
      axios({
        url: "http://127.0.0.1:3000/users/info",
        method: "get",
      }).then((res) => {
        this.userList = res.data;
        console.log(this.userList);
        this.username = this.userList[0].username;
      });
    },
    Oninformation() {
      this.$router.push("/information");
    },

    Onsignout() {
      this.$router.push("/");
    },
    Order() {
      this.$router.go(-1);
    },
  },
};
</script>

<style>
.btn {
  margin-top: 450px;
}
</style>